package com.example.demo.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface UserDao extends BaseMapper<User> {
    List<User> selectAll (int page,int limit);

    @Select(value = "SELECT count(*) FROM users")
    int count();

    @Select(value = "SELECT su.* FROM users su WHERE su.username=#{username}")
    User findUserByName(String username);

}
